package com.example.common.exception;

import com.example.common.controller.BaseController;
import com.example.common.dto.BaseResponse;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice(basePackageClasses = BaseController.class)
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public ResponseEntity<BaseResponse<Void>> handleException(Exception e) {
        // 统一异常处理逻辑
        return new ResponseEntity<BaseResponse<Void>>(
                HttpStatus.INTERNAL_SERVER_ERROR
        );
    }
}